正在寫~
Problem: Need to increase Messenger’s performance as data and number of users grows. Introduce “Iris” messenger engine.
Client
Old: pull-based. the app first received a lightweight push notification indicating new data was available. This triggered the app to send the server a complicated HTTPS query and receive a very large JSON response with the updated conversation view.
New: push-based snapshot + delta model. In this model, the client retrieves an
initial snapshot of their messages (typically the only HTTPS pull ever made)
and then subscribes to delta updates, which are immediately pushed to the app
through MQTT (a low-power, low-bandwidth protocol) as messages are \
received. When the client is pushed an update, it simply applies them to its local
copy of the snapshot. As a result, without ever making an HTTPS request, the
app can quickly display an up-to-date view.
- Server:
- Old: Messaging data has traditionally been stored on spinning disks. In the
pull-based model, we’d write to disk before sending a trigger to Messenger to
read from disk. Thus, this giant storage tier would serve real-time message data
as well as the full conversation history. One large storage tier doesn't scale well
to synchronize recent messages to the app in real time. So in order to support
this new, faster sync protocol and maintain consistency between the Messenger
app and long-term storage, we need to be able to stream the same sequence of
updates in real time to Messenger and to the storage tier in parallel on a per user
basis.